package com.bluegalaxy.nhb.snservice.common.builder;

import com.bluegalaxy.nhb.snservice.domain.vo.ServiceReturn;

/**
 * Created by IntelliJ IDEA.
 *
 * @author:
 * @date: 2020-03-04
 * @time: 10:39
 * @description: To change this template use File | Settings | File Templates.
 */
public class ServiceReturnBuilder {

    /**
     * 执行是否成功
     */
    private boolean success;

    /**
     * 对应国际化中的key
     */
    private String messageKey;

    /**
     * 对应国际化中的占位符
     */
    private Object[] placeholder;

    /**
     * 额外返回处理类
     */
    private Object data;

    /**
     * 备注
     */
    private String remark;

    public static ServiceReturnBuilder createBuilder(){
        return new ServiceReturnBuilder();
    }

    public ServiceReturnBuilder success(boolean success){
        this.success = success;
        return this;
    }

    public ServiceReturnBuilder messageKey(String messageKey){
        this.messageKey = messageKey;
        return this;
    }

    public ServiceReturnBuilder placeholder(Object[] placeholder){
        this.placeholder = placeholder;
        return this;
    }

    public ServiceReturnBuilder data(Object data){
        this.data = data;
        return this;
    }

    public ServiceReturnBuilder remark(String remark){
        this.remark = remark;
        return this;
    }

    public ServiceReturn bulid(){
        ServiceReturn serviceReturn = new ServiceReturn();
        serviceReturn.setSuccess(this.success);
        serviceReturn.setMessageKey(this.messageKey);
        serviceReturn.setPlaceholder(this.placeholder);
        serviceReturn.setData(this.data);
        serviceReturn.setRemark(remark);
        return serviceReturn;
    }

}
